 |
|
 |
Subject: Error : Object variable not set |
 |
 |
 |
Product Area: Notes Client |
 |
Technical Area: Error Message |
 |
Platform: Windows XP client |
 |
Release: 8.5 |
 |
Reproducible: -Reproducibility- |
 |
 |
 |
 |
Hi,
I am attaching an attachment in RichText field.
I am getting an error message " Object Variable not set."
However, when I bring the doc in edit mode and simply save it without any change and then try to attach the attachment then its working fine.
Next time, when I open the doc and try to attach the attachment it works fine.
Here is the code which I am using:
=============================================
Sub Click(Source As Button)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim varitem As Variant
Dim rtitem As NotesRichTextItem
Set db = s.currentdatabase
Set uidoc = ws.currentdocument
Set doc = uidoc.document
filenames = ws.OpenFileDialog(False, "Select an image to be attached", ,"c:\bds\image")
If Not(Isempty(filenames)) Then
Set rtitem = doc.Getfirstitem( "Ima" )
'attach the worksheet
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", filenames(0))
size& = object.FileSize
If (size& > 100000) Then
conform= Msgbox ("Image size is greater than 100KB. Please attach an image having size <=100 KB" , 4144,|Image Size| )
Forall i In rtitem.EmbeddedObjects
If i.type = EMBED_ATTACHMENT Then
Call i.Remove
End If
End Forall
Exit Sub
End If
attachmentname$ = Object.Source
Call rtitem.Update
Call doc.ReplaceItemValue("a_1", "True")
End If
'update the screen with the attachment
Call doc.Save(False,False)
Dim DocUNID As String
DocUNID = doc.UniversalID
doc.SaveOptions = "0"
Call uidoc.Close
Set doc = db.GetDocumentByUNID(DocUNID)
Set uidoc = ws.EditDocument(True, doc)
uidoc.GotoField("Ima")
End Sub
=============================================
Its giving me error on the following line:
Set object = rtitem.EmbedObject ( EMBED_ATTACHMENT, "", filenames(0))
Thanks so much in advance
L TYAGI
 
Feedback number WEBB7VRS72 created by ~Tony Loptumikonyoopsi on 09/10/2009

Status: Open
Comments:

Error : Object variable not set (~Tony Loptumiko... 10.Sep.09)
. . Two thoughts, one obvious, one not.... (~James Brewever... 11.Sep.09) |
|  |
|